package com.codinghero.example.interview.facebook;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class CircularAscArray {

	public static void main(String[] args) {
		Integer[] arr = handleInput();
		int index = 0;
		int times = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] < arr[i - 1]) {
				index = i;
				times++;
			}
		}
		if (arr[0] < arr[arr.length - 1])
			times++;
		
		if (times > 1)
			System.out.println("NO");
		else {
			System.out.println("YES");
			System.out.println(index);
		}
	}

	public static Integer[] handleInput() {
		Scanner cin = new Scanner(System.in);
		List<Integer> list = new ArrayList<Integer>();
		int N = cin.nextInt();
		for (int i = 0; i < N; i++) {
			list.add(cin.nextInt());
		}
		return list.toArray(new Integer[list.size()]);
	}
}
